package com.youdoneed.community.share.web;

import com.youdoneed.base.application.ResultMessage;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.youdoneed.community.common.jpush.JiGuangService;

import com.youdoneed.community.forum.service.ForummessageService;

import cn.jpush.api.push.model.PushPayload;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;

/**
 * 分享模块控制器
 * 包括分享帖子、分享新闻、分享小组、分享视频等
 * @author lid
 * @date 2017.6.1
 */

@RestController
@RequestMapping(value = "/share" , method = {RequestMethod.GET,RequestMethod.POST})
@Api(value = "分享模块控制器", description = "分享模块相关操作")
public class ShareController {
	
	private static final Logger logger = LoggerFactory.getLogger(ShareController.class);
	
	@Autowired
	ForummessageService forummessageService;
	
	@RequestMapping(value = "/shareMsg", method = {RequestMethod.GET,RequestMethod.POST})
    @ApiOperation(notes = "分享别人的帖子", value = "分享别人的帖子")
	public ResultMessage<?> shareMsg(){
		return null;
	}
	
	/**
	 * 极光推送(附加消息类型id)
	 * @param id
	 * @param title
	 * @param msg
	 * @param msgType
	 * @author lixs
	 * @Date 2017.11.6
	 */
	@ResponseBody
	@RequestMapping(value = "/pushMessageForExtraMsg", method = {RequestMethod.GET,RequestMethod.POST})
    @ApiOperation(notes = "极光推送(附加消息类型id)", value = "极光推送(附加消息类型id)")
	public ResultMessage<Boolean> pushMessageForExtraMsg(String id, String title, String msg, String msgType){
		JiGuangService jpush = new JiGuangService();
		jpush.jpushForCoolfaceByAlias(id, title, msg, msgType);
		return  new ResultMessage().toSuccess("推送消息成功！");
	}
	
	/**
	 * 通过用户别名(alias)来推送信息
	 * @param alias
	 * @param title
	 * @param msg
	 * @param msgType
	 * @author lixs
	 * @Date 2017.12.18
	 */
	@ResponseBody
	@RequestMapping(value = "/pushMessageForExtraMsgByAlias", method = {RequestMethod.GET,RequestMethod.POST})
    @ApiOperation(notes = "通过别名极光推送(附加消息类型id)", value = "通过别名极光推送(附加消息类型id)")
	public ResultMessage<Boolean> pushMessageForExtraMsgByAlias(String alias, String title, String msg, String msgType){
		JiGuangService jpush = new JiGuangService();
		jpush.jpushForCoolfaceByAlias(alias, title, msg, msgType);
		return  new ResultMessage().toSuccess("推送消息成功！");
	}
}
